@echo off

setlocal enabledelayedexpansion

set currentPath=%~dp0

set codesPath=%currentPath%Codes\scripts
set clientPath=%currentPath%Cocos\assets\scripts
set serverPath=%currentPath%Server\scripts

@REM 初始化数组
set linkList0=Codes
set linkList1=Core
set linkList2=Decorator
set linkList3=Support

@REM 客户端代码处理
FOR /l %%i IN (0,1,3) do (
    IF EXIST %clientPath%\!linkList%%i! (
        echo Try to remove dir %clientPath%\!linkList%%i!
        rmdir /s /q %clientPath%\!linkList%%i!
    )
    IF EXIST %clientPath%\!linkList%%i! (
        echo Try to delete link %clientPath%\!linkList%%i!
        del /q %clientPath%\!linkList%%i!
    )
)

@REM 服务器代码处理
FOR /l %%i IN (0,1,3) do (
    IF EXIST %serverPath%\!linkList%%i! (
        echo Try to remove dir %serverPath%\!linkList%%i!
        rmdir /s /q %serverPath%\!linkList%%i!
    )
    IF EXIST %serverPath%\!linkList%%i! (
        echo Try to delete link %serverPath%\!linkList%%i!
        del /q %serverPath%\!linkList%%i!
    )
)